import request from '@/utils/request';

export const GetAllRoles = () => request({
  method: 'GET',
  url: '/boss/role/all',
});

export const GetUserRoles = (userId) => request({
  method: 'GET',
  url: `/boss/role/user/${userId}`,
});

export const GetRoleResources = (roleId) => request({
  method: 'GET',
  url: '/boss/resource/getRoleResources',
  params: { roleId },
});

export const GetRole = (id) => request({
  method: 'GET',
  url: `/boss/role/${id}`,
});

export const DeleteRole = (id) => request({
  method: 'DELETE',
  url: `/boss/role/${id}`,
});

export const UpdateRole = (data) => request({
  method: 'POST',
  url: '/boss/role/saveOrUpdate',
  data,
});

export const UpdateUserRole = (data) => request({
  method: 'POST',
  url: '/boss/role/allocateUserRoles',
  data,
});

export const UpdateRoleMenus = (data) => request({
  method: 'POST',
  url: '/boss/menu/allocateRoleMenus',
  data,
});

export const UpdateRoleResources = (data) => request({
  method: 'POST',
  url: '/boss/resource/allocateRoleResources',
  data,
});

export default {};
